package com.example.farmer.Presenter;

import com.example.farmer.Model.Class.ClassModel;
import com.example.farmer.Model.Product.ProductModel;
import com.example.farmer.View.ClassView;
import com.example.farmer.View.ProductView;

import java.util.ArrayList;
import java.util.List;

public class ProductPresenter implements ProductModel, ProductView.IPresenter {
    private ProductView mView;

    public ProductPresenter(ProductView view) {
        mView = view;
        mView.setPresenter(this);


    }


    @Override
    public void getFruit() {
        // 模拟获取热点新闻
        List<String>  fruitList= new ArrayList<>();
        mView.showFruit(fruitList);
    }

    @Override
    public void getVegetable() {
        List<String> vegetableList = new ArrayList<>();
        mView.showVegetable(vegetableList);
    }

    @Override
    public void getSeed() {
        List<String> seedList = new ArrayList<>();
        mView.showSeed(seedList);
    }

    // ClassView.IPresenter接口方法
    public void onTabSelected(int position) {
        switch (position) {
            case 0:
                getFruit();
                break;
            case 1:
                getVegetable();
                break;
            case 2:
                getSeed();
                break;

            // 其他Tab的处理
        }
    }
}
